# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper

# Identical to +pagination_links+ except uses +link_to_remote+ instead of
# +link_to+.  Additional options are:
# +:update+::   same as in +link_to_remote+
	def pagination_links_remote(paginator, options={})
	  update = options.delete(:update)
	  str = pagination_links(paginator, options)
		  if str != nil
			    str.gsub(/href="([^"]*)"/) do
			      url = $1
			      "href=\"#\" onclick=\"new Ajax.Updater('" + update + "', '" + url +
			      "', {asynchronous:true, evalScripts:true}); return false;\"" 
			    end
		end
	end




#Comments helper





	def shake_link
		
		link_to_remote("<span>meneame</span>",
		:update => 'shake-'.concat(@element_id.to_s),
		:url => {:controller=>"comments", :action => :_new_shake,:comment_id=>@comment.id,:ndiv=>@element_id.to_s,:new_shake=>"1"})

	end	
	   
	def number

		@element_id+=1;

	end
	
	def  show_opinions
		
		
		link_to_remote('Opiniones',
			:update=> 'opinions_window_close-'.concat(@element_id.to_s),
			:complete  => visual_effect(:BlindDown),
			:url=> {:controller=>"comments",   :action=>:show_opinions,:comment_id=>@comment.id,:window_id=>@element_id.to_s} )
		
	end	
	

	
	def vote_link1
		

	
		link_to_remote("<img  src='../../images/vote-up01.png'/>",
		:update => 'opinions_list-'.concat(@comment_id),
		:url => {:controller=>"comments", :action => :make_vote,:opinion_id=>@opinion.id,:positive=>1,:comment_id=>@comment_id})
		

	end
	
	def vote_link2
		
		link_to_remote("<img  src='../../images/vote-down02.png'/>",
		:update => 'opinions_list-'.concat(@comment_id),
		:url => {:controller=>"comments", :action => :make_vote,:opinion_id=>@opinion.id,:positive=>0,:comment_id=>@comment_id})

		
	end	
	




















end
